package tcln.gxtx.client.utils;

import java.util.Map;

import tcln.gxtx.client.utils.collection.FastOrderedMap;

import com.extjs.gxt.ui.client.state.Provider;

/**
 * A simplified {@link Provider} that stores all states of all components in client side only.
 * 
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public class StaticDataProvider extends Provider {
    private Map<String, String> staticDataMap = new FastOrderedMap<String>();

    /**
     * {@inheritDoc}
     */
    @Override
    protected void clearKey(String name) {
        staticDataMap.remove(name);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected String getValue(String name) {
        return staticDataMap.get(name);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void setValue(String name, String value) {
        staticDataMap.put(name, value);
    }
}
